package org.xue.snowmall.group.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import org.xue.snowmall.group.entity.JoinRecordEntity;
import org.xue.snowmall.group.service.JoinRecordService;
import org.xue.snowmall.common.utils.PageUtils;
import org.xue.snowmall.common.utils.R;



/**
 * 
 *
 * @author zy
 * @email 2067065884@qq.com
 * @date 2021-09-27 10:40:40
 */
@RestController
@RequestMapping("group/joinrecord")
public class JoinRecordController {
    @Autowired
    private JoinRecordService joinRecordService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = joinRecordService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{gsmJoinId}")
    public R info(@PathVariable("gsmJoinId") Long gsmJoinId){
		JoinRecordEntity joinRecord = joinRecordService.getById(gsmJoinId);

        return R.ok().put("joinRecord", joinRecord);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody JoinRecordEntity joinRecord){
		joinRecordService.save(joinRecord);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody JoinRecordEntity joinRecord){
		joinRecordService.updateById(joinRecord);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] gsmJoinIds){
		joinRecordService.removeByIds(Arrays.asList(gsmJoinIds));

        return R.ok();
    }

}
